home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / tools / upd386.com / UPD386.TXT < prev   
Encoding:
Text File  |  1989-09-12  |  26.6 KB  |  1,054 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.                              A Programmer's Summary of
  23.  
  24.                                80386 CPU Enhancements
  25.  
  26.  
  27.  
  28.                                   Daniel A. Norton
  29.  
  30.                                 CHERRY HILL SOFTWARE
  31.  
  32.                                   September, 1989
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.             Copyright 1989, Daniel A. Norton.
  45.             All Rights Reserved.
  46.  
  47.  
  48.             Permission  is   hereby  granted   for  any   individual  or
  49.             corporation to  copy this  publication provided  that it  is
  50.             copied in whole and not in part, and provided that no charge
  51.             is placed  on its  duplication  beyond  cost  of  labor  and
  52.             materials.   This whole  document includes the 16 pages from
  53.             this cover page to page 16.
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. 80386 CPU Enhancements                          Copyright 1989, Daniel A. Norton
  71.                                                              All Rights Reserved
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.             Intel is a trademark of Intel Corporation.
  79.  
  80.             Microsoft is a registered trademark of Microsoft Corporation
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.             First edition, September 10, 1989
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. 80386 CPU Enhancements                          Copyright 1989, Daniel A. Norton
  137.                                                              All Rights Reserved
  138.  
  139.  
  140.                                     INTRODUCTION
  141.  
  142.             This  summary   describes  the   differences   between   the
  143.             instructions of the Intel 80286 and 80386 processors.  It is
  144.             primarily intended  for programmers who are already familiar
  145.             with the 80286 instruction set.
  146.  
  147.             A more  detailed  description  of  the  80386  processor  is
  148.             presented in  the 80386 Programmer's Reference Manual, order
  149.             number 230985-001,  published by  Intel Literature, 800/548-
  150.             4725.
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195. Introduction                                                        Page 3 of 16
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. 80386 CPU Enhancements                          Copyright 1989, Daniel A. Norton
  203.                                                              All Rights Reserved
  204.  
  205.  
  206.                                 REGISTER EXTENSIONS
  207.  
  208.             The 80386  CPU extends  the 80286  register set by expanding
  209.             all of  the 16-bit  registers to 32 bits, with the exception
  210.             of the  segment registers.  Two additional segment registers
  211.             have been added, FS and GS.
  212.  
  213.             As an  example of  the extension  of the registers, EAX is a
  214.             32-bit register  whose lower  16 bits  are the  familiar  AX
  215.             register.   Although the  upper and lower bytes of AX can be
  216.             accessed independently  through  AH  and  AL,  there  is  no
  217.             support for accessing the upper 16 bits of EAX independently
  218.             from the  lower 16  bits.   The other  32-bit registers  are
  219.             named as  their corresponding 16-bit registers, but with the
  220.             letter "E"  prefixed: EBX,  ECX, EDX,  ESI, EDI,  EBP,  ESP.
  221.             Figure 1,  "32-bit EAX  Register  Layout,"  illustrates  the
  222.             relationship between EAX, AX, AH, and AL.
  223.  
  224.  
  225.                3                        1
  226.                1                        6            8
  227.          +---------------------------+------------+-------------+
  228.          |                 |          |         |
  229.          +---------------------------+------------+-------------+
  230.               <------------------------ EAX ----------------------->
  231.                                           <---------- AX ---------->
  232.                                           <--- AH ---> <---  AL --->
  233.  
  234.  
  235.                                       Figure 1
  236.                              32-bit EAX Register Layout
  237.  
  238.  
  239.             Unlike  the   other  segment   registers,  the  new  segment
  240.             registers, FS  and GS,  have no  default selection  with any
  241.             memory access instructions.  When referencing with FS or GS,
  242.             a segment override must always be specified.
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261. Register Extensions                                                 Page 4 of 16
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. 80386 CPU Enhancements                          Copyright 1989, Daniel A. Norton
  269.                                                              All Rights Reserved
  270.  
  271.  
  272.                            32-BIT OPERANDS AND ADDRESSES
  273.  
  274.             Intel  added  the  32-bit  memory  and  register  references
  275.             without increasing  the number of instruction op-codes to do
  276.             so.    Instead,  the  CPU  has  an  80286-compatible  16-bit
  277.             operation mode,  and a  new  32-bit  operation  mode.    The
  278.             default is 16-bit mode, but this can be overridden in one of
  279.             two ways:  1) By  prefixing the instruction with an operand-
  280.             or address-size  override prefix,  or, in  protect-mode,  by
  281.             specifying a 32-bit code segment.
  282.  
  283.             The operand  size may be 16 or 32 bits.  An instruction that
  284.             normally refers  to AX  will refer  to  EAX  if  the  32-bit
  285.             operand size  is specified.   Similarly, the address size is
  286.             normally 16-bits,  but a  32-bit address is assumed if a 32-
  287.             bit address size is specified.
  288.  
  289.             When running  in protect  mode, one of the attributes of the
  290.             code  segment   descriptor  indicates  whether  or  not  the
  291.             processor is  in 16-bit  or 32-bit  mode.  When operating in
  292.             real-mode, addresses and operands always default to 16 bits.
  293.  
  294.             The current  default modes  can be overridden by an override
  295.             prefix on  the instruction.   The  override only affects the
  296.             instruction to which it is prefixed.  The CPU reverts to the
  297.             default mode  on the  following instruction  (unless  it  is
  298.             overridden again).   The  hexadecimal value  for the operand
  299.             override is  66h.  The address override value is 67h.  These
  300.             overrides may  be used  in combination  to override both the
  301.             address size  and  operand  size  of  the  instruction  that
  302.             follows the operand.
  303.  
  304.             For example,  the instruction  "MOV   AX,BX" in real-mode or
  305.             in a  16-bit protect-mode segment is coded in hexadecimal as
  306.             "8B C3."   In a  32-bit protect-mode segment, the same code,
  307.             "8B C3," would  represent "MOV   EAX,EBX".  To generate "MOV
  308.             EAX,EBX" from  real-mode or  from a 32-bit protect-mode code
  309.             segment, the  opcode contains the operand size prefix and is
  310.             coded as "66 8B C3."
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327. 32-bit Operands and Addresses                                       Page 5 of 16
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. 80386 CPU Enhancements                          Copyright 1989, Daniel A. Norton
  335.                                                              All Rights Reserved
  336.  
  337.  
  338.                                 EFFECTIVE ADDRESSES
  339.  
  340.             With the  80286, a memory operand could be referenced by its
  341.             direct address,  with an  optional  base  using  BX  and  an
  342.             optional index  using SI  or DI.  When referencing  a 32-bit
  343.             address, the  80386 removes  the restriction  of specialized
  344.             registers and  allows any  32-bit non-segment register to be
  345.             used as a base and any 32-bit register except ESP to be used
  346.             as an  index.   Furthermore, the value of the index register
  347.             can be  multiplied by  2, 4,  or 8  before adding  into  the
  348.             effective address.
  349.  
  350.             By allowing  the index  to be scaled in this way, references
  351.             to arrays  whose entries  are each  2, 4,  or 8 bytes can be
  352.             more quickly accessed.  With the 80286, such references must
  353.             be preceeded  with an instruction which multiplies the index
  354.             to obtain the correct byte-offset.
  355.  
  356.             Although this  new feature  can be  used to reference 16-bit
  357.             and real-mode  segments, the programmer must insure that the
  358.             upper 16-bits of the effective address are zero, otherwise a
  359.             General Protection fault will occur (even in real mode).
  360.  
  361.             This example  of the  LEA  instruction  uses  all  addresing
  362.             modes:
  363.  
  364.                       LEA       EAX,[ECX+4*EDX+5]
  365.  
  366.             This example  also illustrates  the new  power  of  the  LEA
  367.             instruction as  provided by the 80386 processor to calculate
  368.             certain first-degree  polynomial  expressions,  placing  the
  369.             result in a register that is not part of the expression.
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393. Effective Addresses                                                 Page 6 of 16
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400. 80386 CPU Enhancements                          Copyright 1989, Daniel A. Norton
  401.                                                              All Rights Reserved
  402.  
  403.  
  404.                                        PAGING
  405.  
  406.             In  addition   to  the  protect-mode  segmentation  features
  407.             available  with   the  80286,  the  80386  CPU  adds  paging
  408.             features.   Paging can  only be  enabled in  conjuction with
  409.             segmenting.  In other words, it can only be enabled when the
  410.             processor is in protected mode.
  411.  
  412.             When  paging   is  disabled,   the  address   calculated  by
  413.             segmentation calculations  is a physical memory address, and
  414.             references  memory   directly.    When  paging  is  enabled,
  415.             however, the address calculated by the segmentation logic is
  416.             referred to  as a linear address (sometimes referred to as a
  417.             "logical address").   The linear address is the input to the
  418.             paging logic,  which converts  the  linear  address  into  a
  419.             physical address.
  420.  
  421.             One advantage  of this extra address translation is to allow
  422.             more than  one task to occupy the same "logical space."  For
  423.             example, programs  that run  in virtual  8086 mode expect to
  424.             see addresses  from 0x00000  to 0xFFFFF.  Normally, only one
  425.             task could occupy this range.  With paging enabled, however,
  426.             each task  will see  the same  logical space, but the paging
  427.             logic will  convert these  addresses to  different  physical
  428.             addresses.
  429.  
  430.             Another advantage  of this  address translation  is to allow
  431.             what is called demand-paging.  A task's logical space can be
  432.             very large  -- larger  than the  available physical  memory.
  433.             Only some  of the  logical space will be present in physical
  434.             memory.  The rest could be stored on disk.  The paging logic
  435.             can be  programmed so that pages that are present are mapped
  436.             to their  corresponding physical  memory addresses.    Pages
  437.             that are not present are marked as such by the paging logic.
  438.             When present  pages are  referenced by  the task,  reads and
  439.             writes exchange  from memory  in the  normal way.  If a task
  440.             references a  page that  is not present, however, the memory
  441.             reference traps  the processor  so that the operating system
  442.             can load the page from disk.
  443.  
  444.             This demand-paging  is similar  to segment  swapping, but is
  445.             different in  that the  size of  all pages  are fixed  (4096
  446.             bytes).   This fixed  size not  only  simplifies  the  logic
  447.             required, but  allows for  not-present pages within a larger
  448.             object.   For example,  if an  application requires  a large
  449.             object, say  64k bytes,  the segment  swapping method  would
  450.             require that all 64k of the object be present in memory when
  451.             any part  of the  object is  loaded.   With paging, only the
  452.             page that is referenced needs to be present.  Of course, one
  453.             could create  segments with lengths limited to 4k bytes, but
  454.  
  455.  
  456.  
  457.  
  458.  
  459. Paging                                                              Page 7 of 16
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466. 80386 CPU Enhancements                          Copyright 1989, Daniel A. Norton
  467.                                                              All Rights Reserved
  468.  
  469.             managing a  single  object  over  several  segments  can  be
  470.             extremely clumsy.
  471.  
  472.  
  473.  
  474.  
  475.  
  476.  
  477.  
  478.  
  479.  
  480.  
  481.  
  482.  
  483.  
  484.  
  485.  
  486.  
  487.  
  488.  
  489.  
  490.  
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525. Paging                                                              Page 8 of 16
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532. 80386 CPU Enhancements                          Copyright 1989, Daniel A. Norton
  533.                                                              All Rights Reserved
  534.  
  535.  
  536.                                   DEBUG REGISTERS
  537.  
  538.             The 80386  CPU expands  upon the  debugging capabilities  of
  539.             "INT 3" and  the trap  flag, by  allowing traps  on specific
  540.             types of  memory references.   This  allows the  CPU to  run
  541.             normally until one of the specified breakpoint conditions is
  542.             met.
  543.  
  544.             The debug  registers allow up to a total of four breakpoints
  545.             to be  active at any one time.  A breakpoint is specified by
  546.             loading  the   debug  registers  with  four  parameters  per
  547.             breakpoint:
  548.  
  549.                  1) Reference Type:
  550.                       - Instruction Execution
  551.                       - Data Write
  552.                       - Data Read or Write
  553.                  2) Reference Address:
  554.                       - 32-bit linear address
  555.                  3) Reference Length:
  556.                       - 1, 2 or 4 bytes
  557.  
  558.             Note  that   in  protect-mode   with  paging   enabled,  the
  559.             breakpoint   address    checking   occurs    before   paging
  560.             translation.   With paging  disabled and  in real  mode, the
  561.             breakpoint address is a physical 32-bit address.
  562.  
  563.             The reference  length for  instruction execution breakpoints
  564.             is always  one (1), regardless of the number of bytes in the
  565.             instruction.  The reference address refers to the first byte
  566.             of the instruction, including prefixes, if any.
  567.  
  568.             If the  reference length for data breakpoints is 2 or 4, the
  569.             reference address  must lie  on a 2-byte or 4-byte boundary,
  570.             respectively.  Any data reference within the specified range
  571.             causes the trap.
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591. Debug Registers                                                     Page 9 of 16
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598. 80386 CPU Enhancements                          Copyright 1989, Daniel A. Norton
  599.                                                              All Rights Reserved
  600.  
  601.  
  602.                                 INSTRUCTION SUMMARY
  603.  
  604.  
  605.  
  606.  
  607.               BSF                                      Bit Scan Forward
  608.  
  609.  
  610.  
  611.             The BSF  instruction searches  the specified  16- or  32-bit
  612.             target for  a "1" bit, starting at the most low-ordered bit,
  613.             and places  the  bit  index  in  the  specified  destination
  614.             register.   The most  low-ordered bit  has an  index of zero
  615.             (0); the  most high-ordered  bit has an index of 15 (for 16-
  616.             bit targets)  or 31  (for 32-bit  targets).  In other words,
  617.             this instruction  searches from  low to  high and counts the
  618.             number of zero bits before the first non-zero bit.
  619.  
  620.             The search  begins at the most low-ordered bit, and proceeds
  621.             up to  the most high-ordered bit.  If all of the bits in the
  622.             target are  zero, the  zero flag  is cleared; otherwise, the
  623.             zero flag  is set  and the destination register contains the
  624.             number of zero bits encountered.
  625.  
  626.             EXAMPLES:
  627.                  BSF  BX,usWord  ; Find the first "1" bit in "usWord"
  628.                  BSF  EAX,EBX    ; Find the first "1" bit in EBX
  629.  
  630.  
  631.  
  632.  
  633.  
  634.  
  635.  
  636.  
  637.  
  638.  
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657. Instruction Summary                                                Page 10 of 16
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664. 80386 CPU Enhancements                          Copyright 1989, Daniel A. Norton
  665.                                                              All Rights Reserved
  666.  
  667.  
  668.  
  669.               BSR                                      Bit Scan Reverse
  670.  
  671.  
  672.  
  673.             The BSR  instruction searches  the specified  16- or  32-bit
  674.             target for a "1" bit, starting at the most high-ordered bit,
  675.             and places  the  bit  index  in  the  specified  destination
  676.             register.   The most  low-ordered bit  has an  index of zero
  677.             (0); the  most high-ordered  bit has an index of 15 (for 16-
  678.             bit targets)  or 31  (for 32-bit  targets).  In other words,
  679.             this instruction  searches from  high to  low and counts the
  680.             number of zero bits before the first non-zero bit.
  681.  
  682.             The search begins at the most high-ordered bit, and proceeds
  683.             down to the most low-ordered bit.  If all of the bits in the
  684.             target are  zero, the  zero flag  is cleared; otherwise, the
  685.             zero flag  is set  and the destination register contains the
  686.             number of zero bits encountered.
  687.  
  688.             EXAMPLES:
  689.                  BSR  BX,usWord  ; Find the first "1" bit in "usWord"
  690.                  BSR  EAX,EBX    ; Find the first "1" bit in EBX
  691.  
  692.  
  693.  
  694.  
  695.  
  696.  
  697.               BT                                               Test Bit
  698.  
  699.  
  700.  
  701.             The BT  instruction copies  the specified bit into the carry
  702.             flag.   The bit  is specified  with two  operands.   The bit
  703.             offset is  truncated to  the number of bits in the specified
  704.             operand.
  705.  
  706.             EXAMPLES:
  707.                  BT   AX,5           ; Test the 0020h bit
  708.                  BT   usWord,BX      ; Test the 2^(BX MOD 16) bit
  709.                  BT   EAX,17         ; Test the 00020000h bit
  710.                  BT   ulDWord,EAX    ; Test the 2^(EAX MOD 32) bit
  711.          BT   AX,17         ; Test the 0002h bit
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723. Instruction Summary                                                Page 11 of 16
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730. 80386 CPU Enhancements                          Copyright 1989, Daniel A. Norton
  731.                                                              All Rights Reserved
  732.  
  733.  
  734.  
  735.               BTC                                        Complement Bit
  736.  
  737.  
  738.  
  739.             The BTC  instruction complements the specified bit.  The bit
  740.             is specified with two operands.  The bit offset is truncated
  741.             to the number of bits in the specified operand.
  742.  
  743.             EXAMPLES:
  744.                  BTC  AX,5           ; Complement the 0020h bit
  745.                  BTC  usWord,BX      ; Complement the 2^(BX MOD 16) bit
  746.                  BTC  EAX,17         ; Complement the 00020000h bit
  747.                  BTC  ulDWord,EAX    ; Complement the 2^(EAX MOD 32) bit
  748.          BTC  AX,17         ; Complement the 0002h bit
  749.  
  750.  
  751.  
  752.  
  753.  
  754.               BTS                                               Set Bit
  755.  
  756.  
  757.  
  758.             The BTS instruction sets the specified bit to 1.  The bit is
  759.             specified with two operands.  The bit offset is truncated to
  760.             the number of bits in the specified operand.
  761.  
  762.             EXAMPLES:
  763.                  BTS  AX,5           ; Set the 0020h bit
  764.                  BTS  usWord,BX      ; Set the 2^(BX MOD 16) bit
  765.                  BTS  EAX,17         ; Set the 00020000h bit
  766.                  BTS  ulDWord,EAX    ; Set the 2^(EAX MOD 32) bit
  767.          BTS  AX,17         ; Set the 0002h bit
  768.  
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789. Instruction Summary                                                Page 12 of 16
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796. 80386 CPU Enhancements                          Copyright 1989, Daniel A. Norton
  797.                                                              All Rights Reserved
  798.  
  799.  
  800.  
  801.              BTR                                              Reset Bit
  802.  
  803.  
  804.  
  805.             The BT  instruction resets  the specified bit to 0.  The bit
  806.             is specified with two operands.  The bit offset is truncated
  807.             to the number of bits in the specified operand.
  808.  
  809.             EXAMPLES:
  810.                  BTR  AX,5           ; Reset the 0020h bit
  811.                  BTR  usWord,BX      ; Reset the 2^(BX MOD 16) bit
  812.                  BTR  EAX,17         ; Reset the 00020000h bit
  813.                  BTR  ulDWord,EAX    ; Reset the 2^(EAX MOD 32) bit
  814.          BTR  AX,17         ; Reset the 0002h bit
  815.  
  816.  
  817.  
  818.  
  819.  
  820.               CDQ                            Sign Extend EAX to EDX:EAX
  821.  
  822.  
  823.  
  824.             The CDQ instruction extends the sign bit of EAX into all 32
  825.             bits of EDX.  CDQ is the 32-/64-bit form of CWD.
  826.  
  827.  
  828.  
  829.  
  830.  
  831.              CWDE                                 Sign Extend AX to EAX
  832.  
  833.  
  834.  
  835.             The CWDE  instruction extends  the sign  bit of  AX into the
  836.             upper 16 bits of EAX.  CWDE is the 32-bit form of CBW.
  837.  
  838.  
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855. Instruction Summary                                                Page 13 of 16
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862. 80386 CPU Enhancements                          Copyright 1989, Daniel A. Norton
  863.                                                              All Rights Reserved
  864.  
  865.  
  866.  
  867.               Jcc                                      Jump Conditional
  868.  
  869.  
  870.  
  871.             The Jcc  instructions have  been extended  on the  80386  to
  872.             allow a  segment-relative (NEAR)  target address (previously
  873.             the target was restricted to an 8-bit relative offset).  All
  874.             conditional  jump   instructions,  except   JCXZ  have  this
  875.             capability.
  876.  
  877.             Programming Tip: A "quirk" in the Microsoft assembler (MASM)
  878.             defaults  all  forward  label  references  to  NEAR  if  the
  879.             instructions  allows   it.     With  the   80826,  the   Jcc
  880.             instructions did  not allow  NEAR offsets, and SHORT offsets
  881.             were generated.   With  the 80386,  NEAR offsets are allowed
  882.             and are the default, even for Jcc instructions.  To override
  883.             this default,  specify the  SHORT modifier on forward target
  884.             references unless you particularly require a NEAR reference.
  885.             Otherwise, the Jcc instruction will use 4 bytes for each Jcc
  886.             in a  16-bit code  segment (as opposed to 2) or 8 bytes in a
  887.             32-bit code segment (as opposed to 2).
  888.  
  889.  
  890.  
  891.  
  892.  
  893.               LFS, LGS, LSS                           Load Full Pointer
  894.  
  895.  
  896.  
  897.             The LFS, LGS and LSS instructions are similar to the LDS and
  898.             LES instructions,  except that  they alter the FS, GS and SS
  899.             registers.
  900.  
  901.             EXAMPLE:
  902.                  LSS  SP,pStack           ; Load a new stack
  903.  
  904.  
  905.  
  906.  
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921. Instruction Summary                                                Page 14 of 16
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928. 80386 CPU Enhancements                          Copyright 1989, Daniel A. Norton
  929.                                                              All Rights Reserved
  930.  
  931.  
  932.  
  933.               MOVSX                           Sign Extend into Register
  934.  
  935.  
  936.  
  937.             The MOVSX  instruction copies  the byte  or  word  from  the
  938.             effective address  into the  destination register, extending
  939.             the sign of the byte or word into the register.
  940.  
  941.             If the  destination is  a  16-bit  register,  the  effective
  942.             address refers  to an 8-bit value that is sign extended.  If
  943.             the destination  is a 32-bit register, the effective address
  944.             may refer to an 8- or 16-bit value.
  945.  
  946.             Programming Tip:  CWDE may  be used in place of MOVSX EAX,AX
  947.             and CBW may be used in place of MOVSX AX,AL.
  948.  
  949.  
  950.  
  951.  
  952.  
  953.               MOVZX                           Zero Extend into Register
  954.  
  955.  
  956.  
  957.             The MOVZX  instruction copies  the byte  or  word  from  the
  958.             effective address  into the  destination register, and zero-
  959.             extends the remaining bits in the destination register.
  960.  
  961.             If the  destination is  a  16-bit  register,  the  effective
  962.             address refers  to an  8-bit value;  the upper 8 bits of the
  963.             destination register  are zeroed.   If  the destination is a
  964.             32-bit register, the effective address may refer to an 8- or
  965.             16-bit value;  the upper  8 or  16 bits  of the  destination
  966.             register are zeroed.
  967.  
  968.             Programming Tip: Instead of programming:
  969.  
  970.                  MOV       AL,BYTE PTR x
  971.                  XOR       AH,AH
  972.  
  973.             use, instead:
  974.  
  975.                  MOVZX     AX,BYTE PTR x
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987. Instruction Summary                                                Page 15 of 16
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994. 80386 CPU Enhancements                          Copyright 1989, Daniel A. Norton
  995.                                                              All Rights Reserved
  996.  
  997.  
  998.  
  999.               SETcc                               Set Byte on Condition
  1000.  
  1001.  
  1002.  
  1003.             The  SETcc  instructions  store  a  byte  at  the  specified
  1004.             destination according  to the  specified condition.   If the
  1005.             condition is TRUE, a 1 is stored; if the condition is FALSE,
  1006.             a 0  is stored.   The condition codes for SETcc are the same
  1007.             as those for the conditional jump instructions.
  1008.  
  1009.  
  1010.  
  1011.  
  1012.  
  1013.               SHLD                          Shift Left Double Precision
  1014.  
  1015.  
  1016.  
  1017.             The SHLD  instruction shifts  the specified  16-  or  32-bit
  1018.             target operand  to the left by the specified number of bits.
  1019.             Bits are  shifted in  on the right from the specified source
  1020.             register, which remains unaltered.
  1021.  
  1022.             EXAMPLES:
  1023.                  SHLD usWord,AX,5   ; Shift "usWord" left 5 bits from AX
  1024.                  SHLD EBX,ECX,CL    ; Shift EBX left "CL" bits from ECX
  1025.  
  1026.  
  1027.  
  1028.  
  1029.  
  1030.  
  1031.              SHRD                          Shift Right Double Precision
  1032.  
  1033.  
  1034.  
  1035.             The SHRD  instruction shifts  the specified  16-  or  32-bit
  1036.             target operand to the right by the specified number of bits.
  1037.             Bits are  shifted in  on the  left from the specified source
  1038.             register, which remains unaltered.
  1039.  
  1040.             EXAMPLES:
  1041.                  SHRD usWord,AX,5   ; Shift "usWord" right 5 bits from AX
  1042.                  SHRD EBX,ECX,CL    ; Shift EBX right "CL" bits from ECX
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053. Instruction Summary                                                Page 16 of 16
  1054.